package com.boot.security.service.authentication;

import com.boot.security.model.vo.AccountInfo;
import io.jsonwebtoken.Claims;
import org.springframework.http.HttpHeaders;
import org.springframework.security.core.AuthenticationException;

/**
 * @author 霜寒 <1621856595@qq.com>
 * @description Token操作
 * @date 2020/2/14 12:00
 **/

public interface TokenService {

    String TOKEN = "Token";
    String AUTHORIZATION = HttpHeaders.AUTHORIZATION;
    String UPGRADE = "Upgrade";

    String build(AccountInfo info) throws AuthenticationException;

    Claims parse(String token) throws AuthenticationException;

    AccountInfo getAccountInfo(Claims claims) throws AuthenticationException;

    void invalid(Claims claims);

    void invalid(Long userId);

    boolean isNotExpired(Claims claims) throws AuthenticationException;

    boolean isNeedUpdate(Claims claims) throws AuthenticationException;

}
